#ifndef AITHREAD_H
#define AITHREAD_H

#include "gamer.h"
#include <qreadwritelock.h>
#include <qmutex.h>
class AIThread : public Gamer
{
    Q_OBJECT
public:
	AIThread(bool b,int d,QList<Steps>& l1);
	virtual void go();
	virtual ~AIThread();
	static double maxValue;
	static Steps s;
	QMutex mutex;
private:
	QList<Steps>& l;
	static QReadWriteLock lock;
	int depth,x,total,xm,xm2,x2;
	double search(double d,double alpha,double beta,bool b);
	double search2(double d,double alpha,double beta,bool b);
	double val(bool b);
	void expend(QList<Steps>& l1,bool b,int &t1,bool r=0);
	void expend2(QList<Steps>& l1,bool b);
};

#endif // AITHREAD_H
